package com.hkemmm.model;


import com.hkemmm.bean.UserInfo;
import com.hkemmm.db.DBProvider;
import com.hkemmm.utils.MyUtils;
import org.apache.commons.dbutils.handlers.BeanListHandler;

import java.util.List;
import java.util.Map;

public class UserModel {
    public boolean canLogin(String userName, String userPsw) {
        boolean canLogin = false;

        //DBProvider db = new DBProvider();
        String str = "select * from userinfo where userName = ? and userPsw = ?";

//        List<Map<String, Object>> listMap= MyUtils.getInstence(DBProvider.class).queryListMap(str, userName, userPsw);
        //
        List<UserInfo> listUser = MyUtils.getInstence(
                            DBProvider.class).query(str,new BeanListHandler<>(UserInfo.class),userName,userPsw);
        if(listUser.size()>=1 ){
            canLogin = true;
        }

        return canLogin;
    }
}
